package demo.component;
/**
 * 邢帅教育
 * <p>
 * 本源代码由数据中心及其作者共同所有，未经版权持有者的事先书面授权，
 * 不得使用、复制、修改、合并、发布、分发和/或销售本源代码的副本。
 *
 * @copyright Copyright (c) 2018. xsteach.com all rights reserved.
 */

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author maikec
 * @date 2018/9/14
 */
@Aspect
@Component
public class DemoAspectJ {

    @Pointcut("execution(* demo.component.DemoComponent.*(..))")
    public void demoComponentAdvice(){}

    @AfterReturning(pointcut="execution(* demo.component.DemoComponent.bye(..))", returning="msg")
    public void aspectj(String msg) {
        System.out.println( DemoAspectJ.class.getSimpleName()+"="+msg );
    }

    @Before("demoComponentAdvice()")
    public void aspectjBefore() {
        System.out.println( DemoAspectJ.class.getSimpleName());
    }
}
